package net.esj.basic.core.utils.jep.function;

import java.util.Stack;

import com.singularsys.jep.EvaluationException;
import com.singularsys.jep.functions.PostfixMathCommand;

public class Date extends PostfixMathCommand {

	
	
	public Date() {
		super();
		numberOfParameters = 1;
	}

	public Date(int arg0) {
		super(arg0);
		numberOfParameters = 1;
	}

	@Override
	public void run(Stack<Object> arg0) throws EvaluationException {
		checkStack(arg0);
		Object da = arg0.pop();
		
		if(da instanceof java.util.Date){
			Long d = ((java.util.Date)da).getTime();
			arg0.push(d);
		}else{
			throw new EvaluationException("Invalid parameter type");
		}
	}

	

}
